package com.axsoft.jobimp.types;

/**
 * 
 * @author RankoR
 *
 * Word (2-bytes)
 */
public class Word extends DataType {
	
	private short mValue;
	
	public final short getValue() {
		return mValue;
	}
	
	public Word() {
		super(2);
		mValue = 0x00;
	}
	
	public Word(final byte[] pData) {
		super(2);
		if (pData.length != 2) {
			return;
		}
		
		mValue = (short) parseByteArray(pData);
		setData(pData);
	}
	
	
	public Word(final short pData) {
		super(2);
		setWord(pData);
	}

	
	public void setWord(final short pData) {
		setByte(0, (byte) (pData >>> 8));
		setByte(1, (byte) (pData));
		
		mValue = pData;
	}
	
}
